package atlantik.game;


public class Auction extends AtlantikIdHolder<Integer, Auction> {

	private Estate estate;

	private Status status;

	private Bid highBid;

	public Auction(Atlantik client) {
		super(client);
	}

	public Estate getEstate() {
		return estate;
	}

	public Status getStatus() {
		return status;
	}

	public Bid getHighBid() {
		return highBid;
	}

	void setEstate(Estate estate) {
		this.estate = estate;
	}

	public void setStatus(Status status) {
		this.status = status;
	}

	void setHighBid(Bid highBid) {
		this.highBid = highBid;
	}

	public class Bid {
		private Player bidder;

		private int bid;

		Bid(Player bidder, int bid) {
			this.bidder = bidder;
			this.bid = bid;
		}

		public Player getBidder() {
			return bidder;
		}

		public int getBid() {
			return bid;
		}
	}

	public static enum Status {
		NONE(0), ONCE(1), TWICE(2), SOLD(3)
		;

		private final int value;

		private Status(int value) {
			this.value = value;
		}

		public static Status fromInt(int v) {
			for (Status s : Status.values())
				if (s.value == v)
					return s;
			return NONE;
		}
	}

}
